<?php
class DomExtension{
	public static function XSLTProcess(DOMDocument $domData, DOMDocument $domTemplate){
		$domTemplate->preserveWhiteSpace = false;
		$xsltProcessor = new XSLTProcessor();
		$xsltProcessor->importStylesheet($domTemplate);
		return $xsltProcessor->transformToDoc($domData);
	}
	public static function arrToXML($arrData, $strRootNodeName = "root"){
		$xmlResult = "<$strRootNodeName>";
		while(list($key, $val) = each($arrData)){
			$xmlResult .= "<".$key.">".utf8_encode($val)."</".$key.">";
		}
		$xmlResult .= "</$strRootNodeName>";
		return $xmlResult;
	}
}